package guifiTest;

import java.util.ArrayList;
import javax.swing.*;

class GuifiGUI extends Thread{
	ArrayList<IP> ips;
	
	public GuifiGUI(ArrayList<IP> s){
		ips=s;
	}
	
	public void run(){
		//Create and set up the window.
        JFrame frame = new JFrame("Guifi.net Connection Tester");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 
        DefaultListModel listModel = new DefaultListModel();
        JList list=new JList(listModel);
        for(int i=0;i<ips.size();i++)
        	listModel.addElement(ips.get(i).getIP()+" --- "+ips.get(i).getReachable());

        frame.getContentPane().add(list);
 
        //Display the window.
        frame.pack();
        frame.setVisible(true);
	}
	
}




public class Main{
	
	public static void main(String[] args) throws InterruptedException{
		Tester t=new Tester();

		t.addIP("192.168.2.1");
		t.addIP("192.168.2.10");
		t.addIP("localhost");
		t.addIP("tomapolla");
		t.addIP("10.228.130.1");
		t.addIP("10.228.131.34");

		javax.swing.SwingUtilities.invokeLater(new GuifiGUI(t.testAll()));
	}
}